:root {
    --primary-color: #3a6eff;
    --secondary-color: #1e40af;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --gradient-start: #3a6eff;
    --gradient-end: #818cf8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    padding: 1.5rem 2rem;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.logo:hover {
    transform: rotate(5deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

h1 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    padding: 2rem;
    max-width: 1200px;
    margin: 80px auto 0;
}

.hero-section {
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
    border-radius: 24px;
    background: white;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

.hero-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: fadeInUp 0.8s ease;
}

.hero-section p {
    font-size: 1.2rem;
    color: #64748b;
    margin-bottom: 2rem;
    animation: fadeInUp 1s ease;
}

.animated-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(58, 110, 255, 0.05),
        rgba(129, 140, 248, 0.05));
    z-index: -1;
    animation: gradientFlow 15s ease infinite;
}

.chat-container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    animation: fadeInUp 1.2s ease;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1rem;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f5f9;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.message {
    margin-bottom: 0;
    padding: 1rem 1.5rem;
    border-radius: 16px;
    max-width: 80%;
    animation: messageSlide 0.3s ease;
}

.user-message {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    margin-left: auto;
    box-shadow: 0 4px 12px rgba(58, 110, 255, 0.2);
}

.ai-message {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-right: auto;
    font-size: 1rem;
    line-height: 1.6;
}

/* Markdown 样式 */
.ai-message h1,
.ai-message h2,
.ai-message h3,
.ai-message h4,
.ai-message h5,
.ai-message h6 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.ai-message p {
    margin-bottom: 1em;
}

.ai-message code {
    background: #f1f5f9;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
}

.ai-message pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 1em;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
}

.ai-message pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.ai-message ul,
.ai-message ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.ai-message li {
    margin-bottom: 0.5em;
}

.ai-message blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1em;
    margin: 1em 0;
    color: #64748b;
}

.ai-message img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
}

.ai-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.ai-message th,
.ai-message td {
    border: 1px solid #e2e8f0;
    padding: 0.5em 1em;
    text-align: left;
}

.ai-message th {
    background: #f1f5f9;
}

/* 代码高亮主题自定义 */
.hljs {
    background: #1e293b !important;
    border-radius: 6px;
}

.chat-input-container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 16px;
}

#userInput {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#userInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(58, 110, 255, 0.1);
}

#sendButton {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#sendButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(58, 110, 255, 0.3);
}

#sendButton:active {
    transform: translateY(0);
}

#sendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #8e9aaf, #a4a4a4);
}

#userInput:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

footer {
    text-align: center;
    padding: 2rem;
    background: white;
    margin-top: 2rem;
    border-radius: 24px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .hero-section h2 {
        font-size: 2rem;
    }

    .hero-section p {
        font-size: 1rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .message {
        max-width: 90%;
    }
}

/* 思考动画样式 */
.thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: thinking 1.4s infinite;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 发送者标识样式 */
.message-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.9rem;
    color: #64748b;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

.user-avatar {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.ai-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}